package week2;

import java.util.Arrays;



public class Week2HW {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		System.out.println("=========================");
		System.out.println("Mike Alonzo and Bo Romero");
		System.out.println("GEOG 288KJ Homework 2");
		System.out.println("1/25/2012");
		System.out.println("=========================");
		System.out.println("");

		
		
		
		//Point
		System.out.println("------------------------------");
		System.out.println("1) Implement a 'Point' object.");
		System.out.println("");
		System.out.println("The original 'testPoint' is entered.");
		Point testPoint = new Point(3,4);
		System.out.println("X coord: "+testPoint.getX());
		System.out.println("Y coord: "+testPoint.getY());
		System.out.println("");
		System.out.println("The new 'userPoint' is entered to calculate distance.");
		Point userPoint = new Point(4,7);
		System.out.println("X coord: "+userPoint.getX());
		System.out.println("Y coord: "+userPoint.getY());
		System.out.println("");
		System.out.println("------------------------------------");
		System.out.println("2) Implement a 'getDistance' method.");
		System.out.println("");
		System.out.println("The distance between the original 'testPoint' and the new 'userPoint' is computed.");
		System.out.println("Distance: "+testPoint.getDistance(userPoint));
		System.out.println("");

		
		
		
		//Bounding box
		System.out.println("-------------------------------------------------------------------------------------");
		System.out.println("3) Implement a 'BoundingBox' object and determine if the 'userPoint' is inside of it.");
		System.out.println("");
		System.out.println("The upper-left point of the 'Bounding Box' is entered.");
		Point ul = new Point(1,8);
		System.out.println("X coord: "+ul.getX());
		System.out.println("Y coord: "+ul.getY());
		System.out.println("");
		System.out.println("The lower-right point of the 'Bounding Box' is entered.");
		Point lr = new Point(10,2);
		System.out.println("X coord: "+lr.getX());
		System.out.println("Y coord: "+lr.getY());
		System.out.println("");
		System.out.println("The 'BoundingBox' is created.");
		System.out.println("");
		System.out.println("The 'isInside' method determines if the 'userPoint' is within the 'BoundingBox'.");
		BoundingBox BB = new BoundingBox(ul,lr);
		if (BB.isInside(userPoint)==true){
			System.out.println("The 'userPoint' is inside the 'BoundingBox'.");
		}
		else if (BB.isInside(userPoint)==false){
			System.out.println("The 'userPoint' is not inside the 'BoundingBox'.");
		}
		System.out.println("");

		
		
		
		//PolyLine
		System.out.println("---------------------------------");
		System.out.println("4) Implement a 'PolyLine' object.");
		double [] xpoints = new double [] {3,4,7,1,2};
		double [] ypoints = new double [] {8,5,8,3,3};
		int npoints = 5;
		PolyLine pl1 = new PolyLine(xpoints, ypoints, npoints);
		System.out.println("");
		System.out.println("There are "+npoints+" points in the 'PolyLine'.");
		System.out.println("The X coords of points in the 'PolyLine' are: "+(Arrays.toString(pl1.xpoints)));
		System.out.println("The Y coords of points in the 'PolyLine' are: "+(Arrays.toString(pl1.ypoints)));
		System.out.println("");

		System.out.println("----------------------------------------------------");
		System.out.println("5) Implement an 'addPoint' method to the 'Polyline'.");		
		System.out.println("");
		System.out.println("The 'addPoint' method adds one 'Point' to the 'PolyLine'.");
		pl1.addPoint(4, 7);
		System.out.println("The X coords of points in the 'PolyLine' are: "+(Arrays.toString(pl1.xpoints)));
		System.out.println("The Y coords of points in the 'PolyLine' are: "+(Arrays.toString(pl1.ypoints)));
		System.out.println("");

		
		
		//Polygon
		System.out.println("--------------------------------");
		System.out.println("6) Implement a 'Polygon' object,");
		System.out.println("   determine if it actually is a polygon,");
		System.out.println("   and show it's coordinates for confirmation.");
		System.out.println("");
		Polygon plg1 = new Polygon(xpoints, ypoints, npoints);  //prints out whether valid polygon or not
		System.out.println("The X coords of points in the 'Polygon' are: "+(Arrays.toString(plg1.xpoints)));
		System.out.println("The Y coords of points in the 'Polygon' are: "+(Arrays.toString(plg1.ypoints)));
		System.out.println("");

		System.out.println("---------------------------------------------------");
		System.out.println("7) Implement an 'addPoint' method to the 'Polygon',");
		System.out.println("   determine if it actually is a polygon,");
		System.out.println("   and show it's coordinates for confirmation.");
		System.out.println("");
		plg1.addPoint(3, 8);
		System.out.println("The X coords of points in the 'Polygon' are: "+(Arrays.toString(plg1.xpoints)));
		System.out.println("The Y coords of points in the 'Polygon' are: "+(Arrays.toString(plg1.ypoints)));
		System.out.println("");			

	}

}
